<template>
  <ul class="todo-main">
    <!--
      自定义事件: 声明式, 编程式, 编程式多层传递可以使用
      高阶函数方式处理 $emit 调用
    -->
    <MyItem v-for="(todo, index) in todos" :key="todo.id"
            :todo="todo"
            @check-todo="(id) => $bus.$emit('check-todo', id)"
            @delete-todo="(id) => $bus.$emit('delete-todo', id)"
    />
  </ul>
</template>
<script>
import MyItem from "@/components/MyList/MyItem/index.vue";

export default {
  name: 'MyList',
  components: {MyItem},
  props: {
    todos: {
      type: Array,
      default: [],
    },
  },
  data() {
    return {}
  },
  methods: {}
}
</script>


<style scoped lang="css">
/*main*/
.todo-main {
  margin-left: 0px;
  border: 1px solid #ddd;
  border-radius: 2px;
  padding: 0px;
}

.todo-empty {
  height: 40px;
  line-height: 40px;
  border: 1px solid #ddd;
  border-radius: 2px;
  padding-left: 5px;
  margin-top: 10px;
}
</style>